package com.kkd.springbootproject.Dao;

import com.kkd.springbootproject.pojo.Department;
import org.springframework.stereotype.Repository;

import javax.swing.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 14587
 * @date 2021/1/14 7:52
 */
//部门dao
@Repository
public class DepartmentDao {
    //模拟数据库
    private static Map<Integer, Department> departments=null;
    static {
        departments=new HashMap<Integer, Department>();
        departments.put(101, new Department(101,"教学部1"));
        departments.put(102, new Department(102,"教学部2"));
        departments.put(103, new Department(103,"教学部3"));
        departments.put(104, new Department(104,"教学部4"));
    }

    public Collection<Department> getDepartments(){
        return departments.values();
    }
    public Department getDepartmentById(Integer id){
        return departments.get(id);
    }
}
